package com.dev;
import android.graphics.Point;
import android.graphics.Rect;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
public class CEditorTab extends TabBar.TypicTab{
	public TabData.CEditor ce;
	public CEditorPage cep;
	public boolean canSave;
	public final static int textColorDefault=0xff123456;
    public CEditorTab(MainActivity ma){
		super(ma);
		setTextColor(textColorDefault);
	}
	public class ActionMenu extends LinearLayout implements OnClickListener{
		GUI.Item itClone;
		ActionMenu(){
			super(ma);
			setOrientation(VERTICAL);
			setBackground(new GUI.BorderDrawable());
			itClone=new GUI.Item(ma);
			itClone.setText("克隆标签页");
		}
		@Override
		public void onClick(View view) {
		}
		void dismiss(){
			ma.wm.removeView(this);
		}
		Point touchDown=new Point();
		@Override
		public boolean onTouchEvent(MotionEvent event){
			int x=(int)event.getX();
			int y=(int)event.getY();
			switch(event.getAction()){
				case MotionEvent.ACTION_DOWN:
					touchDown.x=x;
					touchDown.y=y;
					break;
				case MotionEvent.ACTION_UP:
					Rect visible=new Rect();
					getGlobalVisibleRect(visible);
					int[] is=new int[2];
					getLocationOnScreen(is);
					if(touchDown.x>=visible.right||touchDown.x<visible.right||touchDown.y>=visible.bottom||touchDown.y<visible.top){
						dismiss();
					}
			}
			super.onTouchEvent(event);
			return true;
		}
	}
}
